New switch test

Modified data

In [1]:
filename = ["20200324__{}GHz_301pts_avg 10counts_-2dBm_withAMP_IFBW10_S21_Pt-Py_Volt.txt".format(i) for i in range(7,12)]
filename
Out[1]:
['20200324__7GHz_301pts_avg 10counts_-2dBm_withAMP_IFBW10_S21_Pt-Py_Volt.txt',
 '20200324__8GHz_301pts_avg 10counts_-2dBm_withAMP_IFBW10_S21_Pt-Py_Volt.txt',
 '20200324__9GHz_301pts_avg 10counts_-2dBm_withAMP_IFBW10_S21_Pt-Py_Volt.txt',
 '20200324__10GHz_301pts_avg 10counts_-2dBm_withAMP_IFBW10_S21_Pt-Py_Volt.txt',
 '20200324__11GHz_301pts_avg 10counts_-2dBm_withAMP_IFBW10_S21_Pt-Py_Volt.txt']
In [2]:
for file in filename:
    with open(file, 'r') as f:
        modified_string = ""
        for line in f:
            if line[0]!="#":
                modified_string = modified_string + line
        with open(file[:-4]+"_modified"+".txt", "w") as g:
            g.write(modified_string)
In [3]:
filename_power = ["20200324__7GHz_301pts_avg 10counts_{}dBm_withAMP_IFBW10_S21_Pt-Py_Volt.txt".format(i) for i in range(2,-18,-2)]
for file in filename_power:
    with open(file, 'r') as f:
        modified_string = ""
        for line in f:
            if line[0]!="#":
                modified_string = modified_string + line
        with open(file[:-4]+"_modified"+".txt", "w") as g:
            g.write(modified_string)

Frquency dependence

In [4]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import lmfit
In [5]:
filename = ["20200324__{}GHz_301pts_avg 10counts_-2dBm_withAMP_IFBW10_S21_Pt-Py_Volt_modified.txt".format(i) for i in range(7,12)]
filename[1].split("__")[1].split("GHz")[0]
Out[5]:
'8'
In [6]:
for file in filename:
    data = pd.read_csv(file, sep='\t')
    x = data["Field (G)"].values
    y_x = data["Voltage X (V)"].values * 1E6
    y_y = data["Volatge Y (V)"].values * 1E6
    y_R = data["Voltage R (V)"].values * 1E6
    plt.figure(dpi=150)
    plt.plot(x,y_x, label= "X")
    plt.plot(x,y_y, label="Y")
    plt.plot(x,y_R, label="R")
    plt.xlabel("Field (G)")
    plt.ylabel(r"Voltage ($\mu$V)")
    plt.title("Freq. "+ file.split("__")[1].split("GHz")[0] + " GHz")
    plt.legend()
    plt.savefig("Freq_"+ file.split("__")[1].split("GHz")[0] +".png", dpi = 300)

Fitting V$_{ISHE}$

In [7]:
from scipy.signal import find_peaks
def residual(params, x, y):
    const = params['const'].value
    slope = params['slope'].value
    c = params['c'].value
    A = params['A'].value
    B = params['B'].value
    T = params['T'].value
    Hfmr = params['Hfmr'].value
    model = const + slope * (x-c) + A* T**2/((x-Hfmr)**2+T**2) - B * 2*T*(x-Hfmr)/((x-Hfmr)**2+T**2)
    return np.sqrt((y-model)**2)
def fit_data(params, x):
    const = params['const'].value
    slope = params['slope'].value
    c = params['c'].value
    A = params['A'].value
    B = params['B'].value
    T = params['T'].value
    Hfmr = params['Hfmr'].value
    model = const + slope * (x-c) + A* T**2/((x-Hfmr)**2+T**2) - B * 2*T*(x-Hfmr)/((x-Hfmr)**2+T**2)
    return model
In [8]:
linewidth = []
V_ISHE = []
V_AHE = []
H_FMR = []
for file in filename:
    data = pd.read_csv(file, sep='\t')
    x = data["Field (G)"].values
    y = data["Voltage R (V)"].values * 1E6
    peaks, _= find_peaks(y, height=0.2)
    params = lmfit.Parameters()
    params.add('const', value= 0)
    params.add('slope', value=0)
    params.add('c', value=0)
    params.add('A',value=0)
    params.add('B',value=0)
    params.add('T', value=50)
    params.add('Hfmr', value=x[peaks][0])
    out = lmfit.minimize(residual, params, args=(x,y))
    plt.figure(dpi=150)
    plt.plot(x,y, label = "original Voltage R")
    plt.plot(x, fit_data(out.params,x), label = "fitting data")
    plt.text(10,0.8,r"V$_{ISHE}$: " + "{:.3f}".format(out.params["A"].value))
    V_ISHE.append(out.params["A"].value)
    plt.text(10,0.6,r"V$_{AHE}$: " + "{:.3f}".format(out.params["B"].value))
    V_AHE.append(out.params["B"].value)
    plt.text(10,0.4,r"H$_{FMR}$: "+"{:.3f}".format(out.params["Hfmr"].value))
    H_FMR.append(out.params["Hfmr"].value)
    plt.text(10,0.2,r"Linewidth: {:.3f}".format(out.params["T"].value))
    linewidth.append(out.params["T"].value)
    plt.ylim(-0.1,2)
    plt.legend()
    plt.xlabel("Field (G)")
    plt.ylabel(r"Voltage ($\mu$V)")
    plt.title("Freq. "+ file.split("__")[1].split("GHz")[0] + " GHz")
    plt.savefig("Freq_"+ file.split("__")[1].split("GHz")[0] + "GHz_fitting.png",dpi=300)

Freq. Dependence of V$_{ISHE}$ and V$_{AHE}$

In [9]:
plt.figure(dpi=150)
Freq = np.linspace(7,11,5)
plt.plot(Freq, V_ISHE, label=r"V$_{ISHE}$")
plt.plot(Freq, V_AHE, label=r"V$_{AHE}$")
plt.legend()
plt.savefig("Voltage_Freq_Dependence.png", dpi=300)

Kittel Formula

$f = \frac{ge}{4\pi m} \sqrt{B(B+\mu_{0}M)}$

In [10]:
plt.figure()
plt.plot(H_FMR)
Out[10]:
[<matplotlib.lines.Line2D at 0x1a23edcd50>]
In [11]:
def residual_kittel(params, x, y):
    g = params['g'].value
    M = params['M'].value
    model = g*13991643348.73805*np.sqrt(x*(x+M))*0.0001
    return np.sqrt((y-model)**2)
def fit_data_kittel(params, x):
    g = params['g'].value
    M = params['M'].value
    model = g*13991643348.73805*np.sqrt(x*(x+M))*0.0001
    return model
In [12]:
params = lmfit.Parameters()
params.add('g', value=2)
params.add('M', value=500)
Freq = np.linspace(7,11,5) * 1E9
B = np.array(H_FMR)
out = lmfit.minimize(residual_kittel, params, args=(B,Freq))
In [13]:
out.params
Out[13]:
name value standard error relative error initial value min max vary
g 2.13340672 0.01303084 (0.61%) 2 -inf inf True
M 7533.47303 106.060077 (1.41%) 500 -inf inf True
In [14]:
H_FMR
Out[14]:
[670.0785984661727,
 855.6052420434302,
 1058.9579685300644,
 1275.0168883017823,
 1502.007163848164]
In [15]:
plt.figure(dpi = 150)
plt.plot(B,Freq/1E9, label="Exp. data")
plt.plot(B,fit_data_kittel(out.params,H_FMR)/1E9, label="Fitting data")
plt.title("Kittel Formula Fitting")
plt.text(1300,7.5,r"g factor: {:.3f}".format(out.params["g"].value))
plt.text(1300,7,r"M$_{sat}$"+": {:.3f} G".format(out.params["M"].value))
plt.ylabel("Microwave Frequency (GHz)")
plt.xlabel("Resonance Field (Guass)")
plt.legend()
Out[15]:
<matplotlib.legend.Legend at 0x1a238e7310>

Power Dependence

In [16]:
filename = ["20200324__7GHz_301pts_avg 10counts_{}dBm_withAMP_IFBW10_S21_Pt-Py_Volt_modified.txt".format(i) for i in range(2,-18,-2)]
In [17]:
filename[1].split("_")[5]
Out[17]:
'0dBm'
In [18]:
linewidth = []
V_ISHE = []
H_FMR = []
V_AHE = []
for file in filename:
    data = pd.read_csv(file, sep='\t')
    x = data["Field (G)"].values
    y = data["Voltage R (V)"].values * 1E6
    params = lmfit.Parameters()
    params.add('const', value= 0)
    params.add('slope', value=0)
    params.add('c', value=0)
    params.add('A',value=0)
    params.add('B',value=0)
    params.add('T', value=40)
    params.add('Hfmr', value=600)
    out = lmfit.minimize(residual, params, args=(x,y))
    plt.figure(dpi=150)
    plt.plot(x,y, label = "original Voltage R")
    plt.plot(x, fit_data(out.params,x), label = "fitting data")
    plt.text(1500,2.5,r"V$_{ISHE}$: " + "{:.3f}".format(out.params["A"].value))
    V_ISHE.append(out.params["A"].value)
    plt.text(1500,2,r"V$_{AHE}$: " + "{:.3f}".format(out.params["B"].value))
    V_AHE.append(out.params["B"].value)
    plt.text(1500,1.5,r"H$_{FMR}$: "+"{:.3f}".format(out.params["Hfmr"].value))
    H_FMR.append(out.params["Hfmr"].value)
    plt.text(1500,1,r"Linewidth: {:.3f}".format(np.abs(out.params["T"].value)))
    linewidth.append(np.abs(out.params["T"].value))
    plt.ylim(-0.1,5)
    plt.legend()
    plt.xlabel("Field (G)")
    plt.ylabel(r"Voltage ($\mu$V)")
    plt.title("NA Power "+ file.split("_")[5])
    plt.savefig("NA_Power_"+ file.split("_")[5]+".png", dpi =300)
In [19]:
Power = np.linspace(2,-16,len(V_ISHE))
plt.figure(dpi=150)
plt.plot(10**((Power+20)/10),V_ISHE)
plt.title(r"V$_{ISHE}$ Power Dependence")
plt.xlabel("Power after amp. (mW)")
plt.ylabel(r"Fitting V$_{ISHE}$ ($\mu$V)")
plt.text(7,3.7,"The x axis is a approximation.\n It assume the amplifier has linear gain (20 dB).")
plt.savefig("V_ISHE_power_dependence.png",dpi=300)
In [20]:
Power = np.linspace(2,-16,len(V_AHE))
plt.figure(dpi=150)
plt.plot(10**((Power+20)/10),V_AHE)
plt.title(r"V$_{AHE}$ Power Dependence")
plt.xlabel("Power after amp. (mW)")
plt.ylabel(r"Fitting V$_{AHE}$ ($\mu$V)")
plt.text(7,0.043,"The x axis is a approximation.\n It assume the amplifier has linear gain (20 dB).")
plt.savefig("V_AHE_power_dependence.png",dpi=300)
In [ ]: